const fs = require('fs');

// pipe方法隶属于readStream，多用于文件内容的复制与粘贴。我们将要复制的文件做成readStream，将要粘贴到的文件做成writeStream，这样我们调用readStream.pipe(writeStream)即可实现将复制到的内容粘贴到目标文件里去(会覆盖里面原有的内容)。
const readStream = fs.createReadStream('./2.txt');
const writeStream = fs.createWriteStream('./3.txt');

// 使用方法如下，很简单把
readStream.pipe(writeStream);